$(document).ready(function(){

  $('#registerId').validate({
  
    rules:{
      'name':{
        required: true,
        minlength:6
      },
      'email':{
        required:true,
        email:true
      },
      'password':{
        required:true,
        minlength:8
      },
      'conPassword':{
        required:true,
        equalTo:'#passwordId'
      }, 
      'gender':{
        required:true,
      },
      'address':{
        required:true,
        minlength:10
      },  
      'country':{
        required:true,
      }, 
      'lang[]':{
        required:true,
        minlength:2
      },     
      'hobbies[]':{
        required:true,
        minlength:3
      },
      'avatar':{
          required: true,
          accept: 'gif|jpeg|png|jpg|bmp'
      } 
    },
    messages:{
      'name':{
          required: 'Name is required',
          minlength: $.format("Name should be {0} characters long.") 
      }, 
      'email':{
          required: 'Email is required',
          email: 'Please enter valid email id' 
      },
      'passsword':{
          required: 'Password is required',
          minlength: $.format("Passsword should be {0} characters long.")
      },
      'conPassword':{
          required: 'Confirm Password is required',
          equalTo: 'Passsword not match'
      },     
      'gender':{
          required: 'Please select your gender',
      },
      'address':{
          required: 'Address is required',
          minlength: $.format("Address should be {0} characters long.")
      },  
      'country':{
          required: 'Please select your country',
      },  
      'lang[]':{
          required: $.format("Please select any {0} languages."),
          minlength: $.format("Please select any {0} languages.")
      },
      'hobbies[]':{
          required: $.format("Please select any {0} hobbbies."),
          minlength: $.format("Please select any {0} hobbies.")
      }, 
      'avatar':{
          required: $.format("Please upload your avatar"),
          accept: $.format("Please upload your avatar with valid {0} extn.")
      },  
      
    },// end of messages
    success: function(label) {
      label.next().remove();
            var name = label.attr('for');
            label.text(name+ ' is ok!');
            label.removeClass('error').addClass('success');
        }
  }); // end of validate
}); // end of jquery 